An incorrect network wiring in an Ethernet or an incorrect configuration of a switch may cause the Ethernet to form a loop. When a packet is forwarded in the loop, a broadcast storm is formed, and this severely affects services of the whole network. In view of the broadcast storm caused by the Ethernet loop, a network administrator expects that an Ethernet switch can automatically and precisely locate a port related to a loop failure, and block the related port when the loop failure occurs in the Ethernet, to avoid adverse impact on the whole network.
To minimize a risk caused by the loop failure, usually, a ring protection protocol, such as the Spanning Tree Protocol (STP) or the Ethernet Ring Protection Switching (ERPS), is deployed in the Ethernet ring network. The ring protection protocols support computation of a logical loop-free network on a physical ring (ring) network. However, the ring protection protocol such as STP or ERPS can ensure, only when configurations are correct, that the network does not form a loop logically. When incorrect wiring or an incorrect configuration exists in the network, or a loop is formed in a user network accessed to the Ethernet ring network, or the like, the ring protection protocol such as STP or ERPS cannot resolve a loop failure. Similarly, in a large layer 2 network of a data center, a plurality of access switches access a same aggregation (or core) switch, so that all the access switches are interconnected. When a network wiring is incorrect or a switch is incorrectly configured, a loop also occurs in the large layer 2 network. Consequently, after a flooding packet sent by a switch arrives at another switch through the aggregation (or core) switch, the flooding packet is sent by the another switch back to the switch, causing a broadcast storm.
Currently, in a relatively common loop failure handling method, a switch sends a probe packet, and determines, by monitoring whether the probe packet is received by a same port for a plurality of times, whether a loop exists in a network. If the probe packet is received by a port of the switch for a plurality of times, the switch determines that the port is a faulty port and performs a loop protection action, that is, blocks the faulty port.
However, if a plurality of switches in the loop perform the loop protection action simultaneously (that is, each switch detecting the loop blocks a faulty port of the switch), a plurality of blocking points are formed in the ring network. This may cause an interruption of a normal service.